set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_THREAD_PREFER_PTHREAD ON)
find_package(Threads)
if(CMAKE_HAVE_PTHREAD_H)
    configure_define(HAVE_PTHREAD_H)
    set(HAVE_PTHREAD_H ${CMAKE_HAVE_PTHREAD_H} CACHE INTERNAL "FindThreads found pthread.h")
elseif(CMAKE_USE_PTHREADS_INIT)
    check_cxx_include(pthread.h)
endif()
